<?php
// +----------------------------------------------------------------------
// | 杭州十禾信息科技有限公司
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2015 http://www.shelpe.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: LeePuman <ysyzlsm@163.com>
// +----------------------------------------------------------------------

/**
 * 直通车报表数据API
 */

class RptAdgroupCreativeModel extends RptBaseModel {

	protected $tableName = 'rpt_adgroup_creative';
	/** @var object */
	private $me = null;
	/** @var object */
	private $subwayToken = null;

	/**
	 * 初始化。主要检查session['me']。
	 *
	 */
	public function _initialize() {
		parent :: _initialize();
		$this->me = session('me');
	}

	public function getCreativesStats($user_id, $campaign_id , $adgroup_id , $creative_id, $indicators= 'all',
	    $from = null, $to = null , $type="summary,series") {
	    if(!$from) $from = date('Y-m-d' , strtotime('-7 day'));
	    if(!$to) $to = date('Y-m-d' , strtotime('-1 day'));
	    $stats =$this->getStats($user_id , $creative_id ,$indicators , $from , $to , $type);
	    return $stats;
	}
}